from django.conf.urls import url
from users import  views
from rest_framework_jwt.views import obtain_jwt_token
urlpatterns = [
    url(r'^usernames/(?P<username>\w{5,20})/count/$',views.UserNameCountView.as_view()),
    url(r'^mobiles/(?P<mobile>1[3-9]\d{9})/count/$',views.MobileCountView.as_view()),
    url(r'^users/$',views.UserView.as_view()),
    #　jwt提供的登陆校验功能，并且返回一个token值给前端
    url(r'^authorizations/$',obtain_jwt_token),
    url(r'^user/$',views.UserDetialView.as_view()),
    url(r'^email/$',views.EmailView.as_view()),
    url(r'^emails/verification/$',views.EmailVerifyView.as_view()),
    url(r'^browse_histories/$',views.BrowseHistoriesView.as_view()),
]

# 在users/urls.py中添加路由

from rest_framework.routers import DefaultRouter
router = DefaultRouter()
router.register('addresses', views.AddressViewSet, base_name='addresses')

urlpatterns += router.urls
# POST /addresses/ 新建  -> create
# PUT /addresses/<pk>/ 修改  -> update
# GET /addresses/  查询  -> list
# DELETE /addresses/<pk>/  删除 -> destroy
# PUT /addresses/<pk>/status/ 设置默认 -> status
# PUT /addresses/<pk>/title/  设置标题 -> title